﻿
namespace SnakeGame.Lesson3
{
    internal struct Position
    {
        public int x;
        public int y;

        public Position(int x, int y)
        {
            this.x = x;
            this.y = y;
        }

        //重载运算符 ==，判断两个Position对象是否相等
        public static bool operator ==(Position p1, Position p2)
        {
            return p1.x == p2.x && p1.y == p2.y;
        }

        //重载运算符 !=，判断两个Position对象是否不相等
        public static bool operator !=(Position p1, Position p2)
        {
            return !(p1 == p2);
        }
    }
}
